﻿using Medicine.Dao;
using Medicine.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Medicine.Service
{
    /// <summary>
    /// 用户的服务层
    /// </summary>
    class UserService
    {
        //新建dao层实体
        private UserDao ud = new UserDao();
        /// <summary>
        /// 数据验证
        /// </summary>
        /// <param name="u">待验证的数据</param>
        public void check(User u)
        {
            ud.check(u);
        }
        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="u">user的实体</param>
        public void insert(User u)
        {
            ud.insert(u);
        }

        public void updateInfo(User user) {
            String sql = "UPDATE user_table SET name='"+user.Name+"',passwd='"+user.Passwd+"' WHERE id="+user.Id;
            ud.updateInfo(sql);
        }
    }
}
